<template>
	<view class="content">
		<view class="header-content">
			<view class="header-left">
				<view class="line"></view>
				<view class="header-title">合资品牌</view>
			</view>

			<view class="banner-list" @click="lack">
				<view class="banner-item" v-for="(item,index) in data" :key="index">
					<image class="banner-item-image" :src="item.thumb"></image>
				</view>
			</view>
		</view>

		<view class="building-content">
			<view class="header-left">
				<view class="line"></view>
				<view class="header-title">楼盘套餐</view>
			</view>

			<view class="building-list" @click="lack">
				<view class="building-item" v-for="(item,index) in list" :key="index">
					<image class="building-item-image" :src="item.thumb"></image>
					<view class="building-item-title">{{item.name}}</view>
					<view class="building-item-info">
						<view class="building-item-size">{{item.model}}m²</view>
						<view class="building-item-price">¥{{item.price}}</view>
					</view>
					<view class="building-item-content">{{item.desc_str}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				data: []
			};
		},
		onLoad() {
			uni.request({
				url: 'https://baiyi.kent.work/api/v1/system/getComboList',
				method: 'post',
				data: {
					"page": 1,
					"limit": 10
				},
				success: res => {
					console.log(res);
					this.list = res.data.data.list
				}
			}),
			uni.request({
				url: 'https://baiyi.kent.work/api/v1/system/getBrandList',
				method: 'post',
				data: {},
				success: res => {
					console.log(res);
					this.data = res.data.data
				}
			})
		},
		methods: {
			lack() {
				uni.navigateTo({
					url: "../../pages/lack/lack"
				})
			}
		}
	};
</script>

<style>
	page {
		background-color: #f5f5f5;
	}

	.content {
		width: 100vw;
		height: 100vh;
		box-sizing: border-box;
	}

	.header-content {
		padding: 28rpx 0rpx;
		background-color: white;
	}

	.header-left {
		display: flex;
		align-items: center;
		padding: 0 40rpx 20rpx 40rpx;
	}

	.header-title {
		font-family: PingFang SC, PingFang SC-Bold;
		color: #333333;
		font-size: 32rpx;
		font-weight: 700;
		margin-left: 20rpx;
	}

	.banner-list {
		overflow-x: scroll;
		overflow-y: hidden;
		display: flex;
	}

	.banner-item {
		position: relative;
		height: 168rpx;
		width: 280rpx;
		border-radius: 8rpx;
		margin-left: 40rpx;
	}

	.banner-item-image {
		height: 100%;
		width: 280rpx;
		border-radius: 8rpx;
	}

	.banner-list :last-child {
		margin-right: 40rpx;
	}

	.banner-item-image::after {
		font-family: PingFang SC, PingFang SC-Bold;
		background-color: rgb(0, 0, 0, 0.25);
		content: 'OPPEIN';
		height: 100%;
		width: 100%;
		color: white;
		line-height: 168rpx;
		text-align: center;
		position: absolute;
		font-size: 24rpx;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		margin: auto;
	}

	.line {
		width: 8rpx;
		height: 30rpx;
		background: #3d9c36;
	}

	::-webkit-scrollbar {
		display: none;
	}

	.building-content {
		padding: 28rpx 0rpx;
	}

	.building-list {
		display: grid;
		grid-gap: 40rpx;
		grid-template-columns: 1fr 1fr;
		margin: 0rpx 40rpx;
		padding-bottom: 40rpx;
	}

	.building-item {
		width: 100%;
		background-color: white;
		border-radius: 16rpx;
	}

	.building-item-image {
		border-radius: 16rpx 16rpx 0rpx 0rpx;
		width: 100%;
		height: 420rpx;
	}

	.building-item-title {
		font-family: PingFang SC, PingFang SC-Medium;
		color: #333333;
		font-size: 30rpx;
		font-weight: 500;
		margin-left: 20rpx;
	}

	.building-item-size {
		font-family: PingFang SC, PingFang SC-Medium;
		color: #666666;
		font-size: 24rpx;
		font-weight: 500;
		margin-left: 20rpx;
	}

	.building-item-price {
		font-family: PingFang SC, PingFang SC-Bold;
		font-size: 32rpx;
		font-weight: 500;
		color: #e54040;
		margin-right: 20rpx;
	}

	.building-item-info {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
	}

	.building-item-content {
		font-family: PingFang SC, PingFang SC-Medium;
		font-size: 22rpx;
		color: #666666;
		margin: 8rpx 20rpx 20rpx 20rpx;
	}
</style>